/***************************************************************
*  Copyright (c) 2007 by GroupMe! Team (www.groupme.net)
*  All rights reserved.
*
*  This file is part of the GroupMe! Project. Source code of 
*  this project is closed and redistribution of this code is
*  prohibited. 
*  
*  Contact: http://www.groupme.net
*
*  This copyright notice MUST APPEAR in all copies of the file!
***************************************************************/
package net.groupme.api;

import java.util.ArrayList;
import java.util.List;

/**
 * created on May 7, 2008
 * 
 * This class defines all names/parameters which are part of the API. The API is called
 * by third-party applications.
 * 
 * @author Fabian Abel, <a href="mailto:abel@l3s.de">abel@l3s.de</a>
 * @author last edited by: $Author: fabian $
 * 
 * @version $Revision: 1.5 $ $Date: 2009-04-22 18:28:55 $
 */
public class API_CONSTANTS {
	
	/*
	 * #### BEGIN OF PUBLIC API CONSTANTS ####
	 */

	/** parameter variable that allows to specify the method to be called */
	public static final String PARAMETER_METHOD ="method";
	/** method value that indicates that the client wants to search for resources and groups by given tags */
	public static final String METHOD_SEARCH_FOR_RESOURCES_AND_GROUPS_BY_TAG ="groupme.search";
	/** method value that indicates that the client wants to search for groups by given tags */
	public static final String METHOD_SEARCH_FOR_GROUPS_BY_TAG ="groupme.search.groups";
	/** method value that indicates that the client wants to search for resources (without groups!) by given tags */
	public static final String METHOD_SEARCH_FOR_RESOURCE_BY_TAG ="groupme.search.resources";
	
	
	
	/** parameter which allows to set an offset k so that the top k results of a search are not returned */
	public static final String PARAMETER_OFFSET = "offset";
	
	/** parameter which allows to limit the number of returned results of a search */
	public static final String PARAMETER_LIMIT = "limit";
	
	/** parameter which allows to specify the keyword query */
	public static final String PARAMETER_TAG = "tag";
	
	/** parameter which allows to specify how the keyword query terms should be connected (OR or AND) - Standard conjunction = OR */
	public static final String PARAMETER_TAG_CONJUNCTION = "conjunction";
	/** keyword query terms should be AND-connected  */
	public static final String TAG_CONJUNCTION_AND = "and";
	/** keyword query terms should be OR-connected  */
	public static final String TAG_CONJUNCTION_OR = "or";
	
	
	/** parameter which allows to specify the output format */
	public static final String PARAMETER_OUTPUT = "output";
	/** output value that indicates that the client wants to receive the result in HTML format */
	public static final String OUTPUT_HTML = "html";
	/** output value that indicates that the client wants to receive the result in HTML format optimized for an iFrame*/
	public static final String OUTPUT_HTML_IFRAME = "iframe";
	/** output value that indicates that the client wants to receive the result in plain xml format */
	public static final String OUTPUT_XML = "xml";
	/** output value that indicates that the client wants to receive the result in RDF/XML format */
	public static final String OUTPUT_RDF = "rdf";
	
	/** the parameter that contains the RDF content that is submitted to GroupMe! */
	public static final String RDF_CONTENT = "rdf";
	
	/*
	 * #### END OF PUBLIC API CONSTANTS ####
	 */
	
	
	
	
	
	/*
	 * VIEWS FOR RENDERING THE RESULTS  
	 */
	
	/** ID for the View (JSP) which renders the search result in XML format */
	public static final String VIEW_XML_SEARCHRESULT = "xml-searchresult";
	
	/** ID for the View (JSP) which returns an XML-formated error */
	public static final String VIEW_XML_ERROR = "xml-error";
	
	/** ID for the View (JSP) which returns an RDF representation of a group */
	public static final String VIEW_RDF_GROUP = "rdf-group";
	
	/** ID for the View (JSP) which returns an RDF representation of a group */
	public static final String VIEW_RDF_RESOURCE = "rdf-resource";
	
	/** ID for the View (JSP) which returns an RDF representation of a tag */
	public static final String VIEW_RDF_TAG = "rdf-tag";
	
	/** ID for the View (JSP) which returns an RDF representation of a user */
	public static final String VIEW_RDF_USER = "rdf-user";
	
	/*
	 * MODEL OBJECT NAMES PASSED TO THE JSP
	 */
	/** the list which contains the search result */
	public static final String OBJECT_RESULT_LIST ="object-result-list";
	
	/** the offset that was specified by the client */
	public static final String OBJECT_OFFSET ="object-offset";
	
	/** the tags that were used as the query */
	public static final String OBJECT_QUERY ="object-query";
	
	/*
	 * Helper Variables:
	 */
	
	/** List of all methods of the API */
	public static  List<String> ALL_METHODS = new ArrayList<String>();
	static{
		ALL_METHODS.add(METHOD_SEARCH_FOR_GROUPS_BY_TAG);
		ALL_METHODS.add(METHOD_SEARCH_FOR_RESOURCE_BY_TAG);
		ALL_METHODS.add(METHOD_SEARCH_FOR_RESOURCES_AND_GROUPS_BY_TAG);
	}
	
	/** List of all search methods of the API */
	public static  List<String> ALL_SEARCH_METHODS = new ArrayList<String>();
	static{
		ALL_SEARCH_METHODS.add(METHOD_SEARCH_FOR_GROUPS_BY_TAG);
		ALL_SEARCH_METHODS.add(METHOD_SEARCH_FOR_RESOURCE_BY_TAG);
		ALL_SEARCH_METHODS.add(METHOD_SEARCH_FOR_RESOURCES_AND_GROUPS_BY_TAG);
	}
}
